package com.apanal.qlife.sys.model;

import java.util.List;

import com.apanal.qlife.common.model.BaseModel;
import com.apanal.qlife.common.model.ModelConvert;

/**
 * 角色实体类
 * 
 * 
 * @author shuliangxing
 * 
 * @date 2015-8-31下午5:43:30
 */
public class Role extends BaseModel {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1305391821997551640L;

	/**
	 * id
	 */
	private Long rolId;

	/**
	 * id字符串,逗号分隔
	 */
	private String rolIds;

	/**
	 * 角色名
	 */
	private String rolName;

	/**
	 * 角色描述
	 */
	private String rolDesc;

	/**
	 * 数据是否正常(可逆状态), 1:正常, 0:停用,来自t_dictionary.NORMAL
	 */
	private Integer normal;

	/**
	 * 资源集合
	 */
	private List<Resource> resourceList;

	/**
	 * 资源id字符串,逗号分隔
	 */
	private String resourceIds;

	/**
	 * 资源名称字符串,逗号分隔
	 */
	private String resourceNames;

	public Long getRolId() {
		return rolId;
	}

	public void setRolId(Long rolId) {
		this.rolId = rolId;
	}

	public String getRolName() {
		return rolName;
	}

	public void setRolName(String rolName) {
		this.rolName = rolName == null ? null : rolName.trim();
	}

	public String getRolDesc() {
		return rolDesc;
	}

	public void setRolDesc(String rolDesc) {
		this.rolDesc = rolDesc == null ? null : rolDesc.trim();
	}

	public Integer getNormal() {
		return normal;
	}

	public void setNormal(Integer normal) {
		this.normal = normal;
	}

	public List<Resource> getResourceList() {
		return resourceList;
	}

	public void setResourceList(List<Resource> resourceList) {
		this.resourceList = resourceList;
	}

	public String getResourceIds() {
		if ((resourceIds == null || "".equals(resourceIds))
				&& resourceList != null && !resourceList.isEmpty()) {
			return ModelConvert.getIds(resourceList);
		} else {
			return resourceIds;
		}
	}

	public void setResourceIds(String resourceIds) {
		this.resourceIds = resourceIds;
	}

	public String getRolIds() {
		return rolIds;
	}

	public void setRolIds(String rolIds) {
		this.rolIds = rolIds;
	}

	public String getResourceNames() {
		if ((resourceNames == null || "".equals(resourceNames))
				&& resourceList != null && !resourceList.isEmpty()) {
			return ModelConvert.getNames(resourceList);
		} else {
			return resourceNames;
		}
	}

	public void setResourceNames(String resourceNames) {
		this.resourceNames = resourceNames;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	@Override
	public String toString() {
		return "Role [rolId=" + rolId + ", rolIds=" + rolIds + ", rolName="
				+ rolName + ", rolDesc=" + rolDesc + ", normal=" + normal
				+ ", resourceList=" + resourceList + ", resourceIds="
				+ resourceIds + ", resourceNames=" + resourceNames + "]";
	}

}